package com.magic.gre.mvp.presenter;

import com.google.gson.reflect.TypeToken;
import com.magic.gre.entity.WordsBean;
import com.magic.gre.entity.base.BaseListModel;
import com.magic.gre.mvp.contract.LearnFinishContract;
import com.magic.gre.mvp.model.LearnFinishModelImpl;
import com.noname.lib_base_java.mvp.BasePresenterImpl;

/**
 * Author: Lmoumou
 * Date: 2019-01-08 16:01
 * 文件名: LearnFinishPresebterImpl
 * 描述:
 */
public class LearnFinishPresebterImpl extends BasePresenterImpl<LearnFinishContract.View, LearnFinishContract.Model>
        implements LearnFinishContract.Presenter {
    public LearnFinishPresebterImpl(LearnFinishContract.View view) {
        super(view);
    }

    @Override
    protected LearnFinishContract.Model creatModel() {
        return new LearnFinishModelImpl();
    }

    @Override
    public void pLearnRecordList(int pageNo) {
        mModel.mLearnRecordList(new CommonObserver<BaseListModel<WordsBean>>(new TypeToken<BaseListModel<WordsBean>>(){}.getType()) {
            @Override
            protected void onSuccess(BaseListModel<WordsBean> wordsBeanBaseListModel) {
                mView.vLearnRecordList(wordsBeanBaseListModel.body);
            }

            @Override
            public void onError(int status, String msg) {

            }
        }, pageNo);
    }
}
